<style>
.setimg{
	margin:-2px 5px 0 0 
}
#addform .file{
	position: relative;
}
#addform .file span{
	position: absolute;
	right: 80px;
	top: 15px;
	background-color: #414959;
	padding: 2px 6px;
	height: 23px;
	line-height: 23px;
	cursor: pointer;
	color: #fff;
	font-size: 14px;
	overflow: hidden;
	background-image: linear-gradient(to bottom, #6c7994, #414959);
	border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
	border: 1px solid #363d4a;
	display: inline-block;
	*display: inline;
	*zoom: 1;
}
#addform .file span input{
	position: absolute;
	font-size: 100px;
	left: 0;
	top: 0;
	opacity: 0;
	filter: alpha(opacity=0);
	cursor: pointer;
}
</style>
<div class="row-fluid">
	<a style="border:1px solid #ccc" class="block-heading" data-toggle="collapse">列表数据</a>
    <div class="well">
		<!-- <button class="btn btn-primary ifrm" data-url="/index/addInput" data-width="720" data-height="650" data-title="录入信息" data-params="" style="float:right;padding:3px 6px">录入信息</button> -->
	    <div class="btn-toolbar">
		    <form>
		    	<input class="input input-medium" type="text" name="card_number" value="<?=I('get.card_number')?>" style="width: 80px;text-align: center" placeholder="卡券编号"/>
				<select name="card_status" class="card_status" style="width:130px;margin-left: 5px;">
					<option value="all" <?='all' == I('get.card_status')? 'selected': ''?>>卡券状态/全部</option>
					<foreach name="card_status" item="vo" key="ke">
						<option value="<?=$ke?>" <?=$ke == I('get.card_status')? 'selected': ''?>><?=$vo?></option>
					</foreach>
				</select>
				<select name="xiubu_type" class="xiubu_type" style="width:130px;margin-left: 5px;">
					<option value="all" <?='all' == I('get.xiubu_type')? 'selected': ''?>>修补类型/全部</option>
					<option value="1" <?=I('get.xiubu_type')=='1'? 'selected': ''?>>本人修补</option>
					<option value="2" <?=I('get.xiubu_type')=='2'? 'selected': ''?>>他人修补</option>
				</select>
		    	<input class="input input-medium" type="text" name="user_name" value="<?=I('get.user_name')?>" style="width: 60px;margin-left:10px;text-align: center" placeholder="顾客名字"/>
		    	<input class="input input-medium" type="text" name="user_mobile" value="<?=I('get.user_mobile')?>" style="width: 100px;margin-left:10px;text-align: center" placeholder="顾客手机"/>
		    	<!--<input class="input input-medium" type="text" name="group_address" value="<?=I('get.group_address')?>" style="width: 60px;margin-left:10px;text-align: center" placeholder="组会地点"/>-->
		    	<input class="input input-medium" type="text" name="use_project" value="<?=I('get.use_project')?>" style="width: 100px;margin-left:10px;text-align: center" placeholder="销券套餐"/>
		    	<input class="input input-medium" type="text" name="xiubu_project" value="<?=I('get.xiubu_project')?>" style="width: 100px;margin-left:10px;text-align: center" placeholder="修补套餐"/>
		    	<!--<input readonly name="stime" class="input input-medium" onclick='WdatePicker({dateFmt:"yyyy-MM-dd"})' type="text" placeholder="组会时间-开始" value="<?=I('get.stime')?>" style="width:100px;margin-left:10px;text-align: center"/>&nbsp;-->
                <!--<input readonly style="margin-left:10px;width: 100px;text-align: center" name="etime" placeholder="组会时间-结束" class="input input-medium" onclick='WdatePicker({dateFmt:"yyyy-MM-dd"})' type="text" value="<?=I('get.etime')?>"/>-->
                <!--<input readonly name="xq_stime" class="input input-medium" onclick='WdatePicker({dateFmt:"yyyy-MM-dd"})' type="text" placeholder="销券时间-开始" value="<?=I('get.xq_stime')?>" style="width:100px;margin-left:10px;text-align: center"/>&nbsp;-->
                <!--<input readonly style="margin-left:10px;width:100px;text-align: center" name="xq_etime" placeholder="销券时间-结束" class="input input-medium" onclick='WdatePicker({dateFmt:"yyyy-MM-dd"})' type="text" value="<?=I('get.xq_etime')?>"/>-->
		    	<input type="hidden" value="<?=I('get.res')?>" name="res" />
		    	<button class="btn btn-info" style="margin:-9px 0 0 15px"><i class="icon-search"></i> 搜索</button>
		    </form>
		    <?php if(session('role_id') != 1){?>
			<!--<form id="addform" action="/index/input_csv1" method="post" enctype="multipart/form-data">-->
				<!--<p class="file">-->
					<!--请选择要导入的CSV文件：<br/>-->
					<!--<span>-->
						<!--<input type="file" name="file">-->
						<!--导入数据-->
					<!--</span>&lt;!&ndash;<input type="submit" class="btn" value="导入CSV">&ndash;&gt;-->
				<!--</p>-->
			<!--</form>-->
		    <a href="/index/custExportExcel?card_number=<?=I('get.card_number')?>&user_name=<?=I('get.user_name')?>&group_address=<?=I('get.group_address')?>&counselor=<?=I('get.counselor')?>&designer=<?=I('get.designer')?>&director=<?=I('get.director')?>&classroom=<?=I('get.classroom')?>&shopper=<?=I('get.shopper')?>&stime=<?=I('get.stime')?>&etime=<?=I('get.etime')?>"><button class="btn btn-primary" style="position:relative;float:right;padding:3px 6px;margin-right:0px;margin-top: -15px;">导出数据</button></a>
		    <?php }?>
		</div>
		<hr>

	<?php $card_status = ['0'=>'可用','1'=>'已使用未修补','3'=>'已修补'];?>
		<table class="table">
		      <thead>
		        <tr>
		          <th style="text-align:center;">序号</th>
		          <th style="text-align:center;">卡券编号</th>
		          <th style="text-align:center;">防伪码</th>
		          <th style="text-align:center;">卡券状态</th>
		          <th style="text-align:center;">顾客名</th>
		          <th style="text-align:center;">顾客手机号</th>
                  <th style="text-align:center;">组会地点</th>
		          <th style="text-align:center;">销券套餐</th>
		          <th style="text-align:center;">修补套餐</th>
		      	  <th style="text-align:center;">有效期</th>
		      	  <th style="text-align:center;">销券时间</th>
		      	  <th style="text-align:center;">修补类型</th>
		      	  <th style="text-align:center;">修补人姓名</th>
		      	  <th style="text-align:center;">修补人手机号</th>
		      	  <th style="text-align:center;">修补时间</th>
		      	  <!--<th style="text-align:center;">操作</th>-->
		        </tr>
		      </thead>
		      <tbody>
		      	<?php if($getData){foreach($getData AS $key=>$val){ ?>
		        <tr> 
		          <td style="text-align:center;vertical-align:middle;"><?=$val['id']?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['card_number']?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['security_code']?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$card_status[$val['card_status']]?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['user_name']?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['user_mobile']?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['group_address']?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['use_project']?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['xiubu_project']?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['valid_at']?date('Y-m-d H:i',$val['valid_at']):'-'?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['use_at']?date('Y-m-d H:i',$val['use_at']):'-'?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['xiubu_type']?'他人修补':'本人修补'?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['xiubu_uname']?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['xiubu_mobile']?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['xiubu_at']?date('Y-m-d H:i',$val['xiubu_at']):'-'?></td>
		          <!--<td style="text-align:center;vertical-align:middle;">-->
					<!--<a class="ifrm btn btn-info" href="javascript:void(0)" data-url="/index/addInput" style="padding: 0px 4px;" data-width="720" data-height="650" data-title="修改信息" data-params="id/<?=$val['id']?>"><i class="icon-pencil"></i></a>&nbsp;&nbsp;-->
					<!--<?php if(session('role_id') == 1 ){?>-->
					 <!--<a href="/index/delInput?id=<?=$val['id']?>" class="decate btn btn-danger" style="padding: 0px 4px;" role="button" title="删除信息" data-toggle="modal"><i class="icon-remove"></i></a>&nbsp;&nbsp;-->
					<!--<?php }?>-->
				 <!--</td>-->
		        </tr>
		        <?php }}else{?>
		        	<tr><td style="text-align:center" colspan=15>暂无数据</td></tr>
		        <?php }?>
		      </tbody>
		   </table>
		   <span style="float:right;margin-top:-44px"><?=$page?></span>
	</div>
</div>
<script>
$(function(){
	$('.decate').click(function(){
		if(!window.confirm('确认'+$(this).attr('title')+'吗 ?')){
			return false;
		}
		window.location = $(this).attr('href');
	});

	$('input[name=file]').change(function(){
		var formData = new FormData($( "#addform" )[0]);
		$.ajax({
			url: '/index/input_csv1',
			type: 'POST',
			dataType: 'json',
			contentType: false,
          	processData: false,
			data: formData,
			success:function(d){
					if(d.code == 0){
						showmsg('导入成功',1);
						setTimeout(function(){window.location.href='/index/input';},2000);
					}else{
						showmsg(d.msg);
						return false;
					}
                
            }
			})
		})
})
</script>